var mydialog;

function cu_cont_add(){
	var ba_cont=$("#ba_cont").val();
	var ba_remk=$("#ba_remk").val();
	var sort_id=$("#sort_id").val();
	
	if(ba_cont==''){
		alert('平日、假日連絡不能為空');
		return;
	}
	
	$.ajax({
		url:'cu_cont',
		type:'post',
		data:{operator:'31',type:2,ba_cont:ba_cont,ba_remk:ba_remk,sort_id:sort_id},
		dataType:'json',
		success:cu_cont_add_status,
		error:function(XMLHttpRequest, textStatus, errorThrown){alert(textStatus);}
	});
}

function cu_cont_add_status(data){
	if(data.status===1){
		location.reload();
	}
}

function cu_cont_alter(id){
	var data=$("#"+id).html();
	art.dialog({
		title:'平日、假日連絡-修改',
		content:data,
		lock:true
	});
}

function cu_cont_del(id){
	if(confirm('您確定刪除嗎?')){
		mydialog=art.dialog({title:'請稍候...',lock:true});
		$.ajax({
			url:'cu_cont',
			type:'post',
			dataType:'json',
			data:{operator:'31',type:4,id:id},
			success:cu_nation_del_status,
			error:function(XMLHttpRequest, textStatus, errorThrown){alert(textStatus);}
		});
	}
}

function cu_nation_del_status(data){
	if(data.status===1){
		mydialog.content('刪除成功');
		location.reload();
	}
}